﻿using System;
using System.Collections;
using UnityEngine;

public class BurnSystem: Singleton<BurnSystem>
{
    [SerializeField] private GameObject burnVFX;
    
    private void OnEnable()
    {
        ActionSystem.AttachPerformer<ApplyBurnGA>(AddBurnPerformer);
    }
    private void OnDisable()
    {
        ActionSystem.DetachPerformer<ApplyBurnGA>();
    }
    private IEnumerator AddBurnPerformer(ApplyBurnGA addBurnGA)
    {
        CombatantView target = addBurnGA.Target;
        Instantiate(burnVFX, target.transform.position, Quaternion.identity);
        target.Damage(addBurnGA.BurnDamage);
        target.RemoveStatusEffect(StatusEffectType.BURN, 1);
        yield return new WaitForSeconds(1f);
    }
}
